package han_meng_fei_sha.wai_mai_shun_feng_che;
import android.app.Application;
import android.os.Looper;
import android.util.Log;
import android.widget.Toast;

import han_meng_fei_sha.wai_mai_shun_feng_che.util.吐司工具;
import han_meng_fei_sha.wai_mai_shun_feng_che.util.日志工具;
/**
 韩梦飞沙 韩亚飞 313134555@qq.com yue31313 han_meng_fei_sha
 on 2017/11/5.
 */
public class MyApp extends Application implements Thread.UncaughtExceptionHandler
{

    @Override
    public void onCreate()
    {
        super.onCreate();
        初始化数据();
    }
    @Override
    public void uncaughtException(Thread thread,final Throwable throwable)
    {
        new Thread(new Runnable() {
            @Override
            public void run() {
                Looper.prepare();
                Toast.makeText(getApplicationContext(), "不好意思。出现了问题。工程师正在赶工修复。" + throwable.getMessage(), Toast.LENGTH_LONG).show();
                Looper.loop();
            }
        }).start();
        日志工具.错误("未捕获异常【】" + Log.getStackTraceString(throwable));
    }

    public static 吐司工具 提示工具;
    private void 初始化数据()
    {
        提示工具 = new 吐司工具(this);
    }

}
